public class YiDongLing {
    //https://leetcode.cn/problems/move-zeroes/description/
    public void moveZeroes(int[] nums) {
        int cur=0;
        int dest=-1;
        while(cur<nums.length) {
            if(nums[cur]==0) {
                cur++;
            } else {
                swap(nums,dest+1,cur);
                cur++;
                dest++;
            }
        }
    }
    private void swap(int[] array,int i,int j) {
        int tmp=array[i];
        array[i]=array[j];
        array[j]=tmp;
    }
}
